package leetcode.Y2024M6.study;

import leetcode.Y2024M6.TreeNode;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class S230 {
    List<Integer> res = new ArrayList<>();

    public int kthSmallest(TreeNode root, int k) {
        midView(root);
        return res.get(k - 1);
    }

    private void midView(TreeNode root) {
        if (root == null) return;
        midView(root.left);
        res.add(root.val);
        midView(root.right);
    }

    @Test
    public void test() {

    }
}
